/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author luksCastro
 */
@Entity
@Table(name = "lineacompra")
@NamedQueries({
    @NamedQuery(name = "Lineacompra.findAll", query = "SELECT l FROM Lineacompra l")})
public class Lineacompra implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idLineaCompra")
    private Integer idLineaCompra;
    @Column(name = "cantidad")
    private Integer cantidad;
    @Column(name = "subtotal")
    private Integer subtotal;
    @JoinColumn(name = "id_repuesto", referencedColumnName = "idRepuesto")
    @ManyToOne
    private Repuesto idRepuesto;
    @JoinColumn(name = "id_compra", referencedColumnName = "idCompra")
    @ManyToOne
    private Compra idCompra;

    public Lineacompra() {
    }

    public Lineacompra(Integer idLineaCompra) {
        this.idLineaCompra = idLineaCompra;
    }

    public Integer getIdLineaCompra() {
        return idLineaCompra;
    }

    public void setIdLineaCompra(Integer idLineaCompra) {
        this.idLineaCompra = idLineaCompra;
    }

    public Integer getCantidad() {
        return cantidad;
    }

    public void setCantidad(Integer cantidad) {
        this.cantidad = cantidad;
    }

    public Integer getSubtotal() {
        return subtotal;
    }

    public void setSubtotal(Integer subtotal) {
        this.subtotal = subtotal;
    }

    public Repuesto getIdRepuesto() {
        return idRepuesto;
    }

    public void setIdRepuesto(Repuesto idRepuesto) {
        this.idRepuesto = idRepuesto;
    }

    public Compra getIdCompra() {
        return idCompra;
    }

    public void setIdCompra(Compra idCompra) {
        this.idCompra = idCompra;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLineaCompra != null ? idLineaCompra.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Lineacompra)) {
            return false;
        }
        Lineacompra other = (Lineacompra) object;
        if ((this.idLineaCompra == null && other.idLineaCompra != null) || (this.idLineaCompra != null && !this.idLineaCompra.equals(other.idLineaCompra))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Lineacompra[ idLineaCompra=" + idLineaCompra + " ]";
    }
    
}
